<template>
<!--pages/distribut/poster/poster.wxml-->
</template>

<script>
// pages/distribut/poster/poster.js
var app = getApp();
var request = app.globalData.request;
var setting = app.globalData.setting;

export default {
  data() {
    return {
      look: false
    };
  },

  components: {},
  props: {},

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    request.get('/api/user/getUserPoster', {
      success: function (res) {
        if (res.data.result.status == 1 && res.data.result.result == -1) {
          app.globalData.showTextWarining(res.data.result.msg, function () {
            uni.navigateBack({
              delta: 1
            });
          });
        } else {
          that.getHttpImages(res.data);
        }
      }
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    if (this.look) {
      this.look = false, uni.navigateBack({
        delta: 1
      });
    }
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {},

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {},

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {},

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {},

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {},
  methods: {
    getHttpImages: function (data) {
      this.look = true;
      uni.getImageInfo({
        src: setting.url + data.result,
        success: function (res) {
          uni.previewImage({
            urls: [res.path]
          });
        }
      });
    }
  }
};
</script>
<style>
/* pages/distribut/poster/poster.wxss */
</style>